import { defineEventHandler, proxyRequest } from 'h3'

export default defineEventHandler(async (event) => {
  const url = event.req.url || ''
  // 排除 nuxt icon 资源
  if (url.startsWith('/api') && !url.startsWith('/api/_nuxt_icon')) {
    const target = 'http://jiaocai-web.dev.multimediapress.cn'
    const realUrl = url.replace(/^\/api/, '')
    return proxyRequest(event, target + realUrl)
  }
  // 其它请求交给 Nuxt 处理
}) 


